#include<bits/stdc++.h>
using namespace std;
#define size1 20
#define size2 40
int ans;
int main(){
	do{
		system("make_data.exe");
		system("bfs1.0.exe");
		freopen("result.out","r",stdin);
		ans=-3;
		for(int i=0;i<=size1;i++){
			for(int j=0;j<=size2;j++){
				int s;
				scanf("%d",&s);
				ans=max(ans,s);
			}
		}
	}while(ans<30);
	system("outss.exe");
	return 0;
}
